// JavaScript Document
var loadm='ok';
function CheckCar_m()
{
	UpdateCar();
	if(!isRightNo(_Car.pjc+_Car.cjc+_Car.cphm))
	{
		alert('车牌输入错误，请重新输入！');
		return false;
	}
	
	if(_SelectCity.classno>0)
	{
		if(_SelectCity.classno!=_Car.classa.length ||!isNumberAndChar(_Car.classa))
		{
			document.getElementById("tipclassbox").innerHTML='车架号输入错误，请核对后重新输入！';
			document.getElementById("tipclassbox").style.display='block';			
			//alert(_SelectCity.classno_text);
			document.getElementById("my_cjhm").focus();
			return false;
		}
	}else if(_SelectCity.classno==-1)
	{
		if(_Car.classa.length<4 ||!isNumberAndChar(_Car.classa)||_Car.classa==_SelectCity.classno_text)
		{
			document.getElementById("tipclassbox").innerHTML='车架号输入错误，请核对后重新输入！';
			document.getElementById("tipclassbox").style.display='block';			
			//alert(_SelectCity.classno_text);
			document.getElementById("my_cjhm").focus();
			return false;
		}
	}
	if(_SelectCity.engineno>0)
	{
		if(_SelectCity.engineno!=_Car.engine.length ||!isNumberAndChar(_Car.engine))
		{
			document.getElementById("tipenginebox").innerHTML='发动机号输入错误，请核对后重新输入！';
			document.getElementById("tipenginebox").style.display='block';
			//alert(_SelectCity.engineno_text);
			document.getElementById("my_fdjh").focus();
			return false;
		}
	}else if(_SelectCity.engineno==-1)
	{
		if(_Car.engine.length<4 ||!isNumberAndChar(_Car.engine)||_Car.engine==_SelectCity.engineno_text)
		{
			document.getElementById("tipenginebox").innerHTML='发动机号输入错误，请核对后重新输入！';
			document.getElementById("tipenginebox").style.display='block';
			//alert(_SelectCity.engineno_text);
			document.getElementById("my_fdjh").focus();
			return false;
		}
	}
	return true;
	
}
function checkinput_m(obj)
{
	obj.value=Jtrim(obj.value);
	obj.value=obj.value.toUpperCase();
	if(obj.id=="my_cphm")
	{
		document.getElementById("line2").style.display="block";
		document.getElementById("line3").style.display="block";
		return;
	}
	if(obj.value.length>10)
	{
		if(obj.id=="my_cjhm")
		{
			document.getElementById("classtext").style.display="none";
		}else
		{
			document.getElementById("enginetext").style.display="none";
		}
	}else 
	{
		if(obj.id=="my_cjhm")
		{
			document.getElementById("classtext").style.display="block";
		}else
		{
			document.getElementById("enginetext").style.display="block";
		}
	}
	document.getElementById("tipenginebox").style.display='none';
	document.getElementById("tipclassbox").style.display='none';
}
function fsubmit_m(nline)
{
	if(!CheckCar_m())
	{
		return false;
	}else
	{
		SetParamValue();
		var obj=document.getElementById("my_form");
		if(_Car.hpzl!='02')
		{
			obj.action='http://m.weizhang8.cn/query_m_link.php';
		}else
		{
			if(nline==2)
			{
				if(_SelectCity.id_360>0)
				{
					obj.action='http://chaxun.weizhang8.cn/query_m_360.php';
				}else
				{
					obj.action='http://m.weizhang8.cn/query_m_link.php';
				}
				//obj.action='http://chaxun.weizhang8.cn/query36088.php';
				//obj.action='http://chaxun.weizhang8.cn/queryhj88.php';
			}else if(nline==1)
			{
				if(_SelectCity.jh_city_code!='')
				{
					obj.action='http://m.weizhang8.cn/query_m.php';
				}else
				{
					obj.action='http://m.weizhang8.cn/query_m_link.php';
				}
			}else if(nline==3)
			{
					obj.action='http://m.weizhang8.cn/query_m_link.php';
			}else
			{
				obj.action='http://m.weizhang8.cn/query_m_link.php';
			}
		}
		AddCarCookie();
		obj.submit();
		updateHistoryCars();
		SetCookie("olduser","1",365);
	}
}
function updateipcity()
{
	try{
		if(ip_c!='')
		{
			setSelProvince(ip_p);
			updatecityn(ip_c);
			updateAll();
			
		}else if(ip_p!='')
		{
			setSelProvince(ip_p);
			updateAll();
		}else
		{
			//setSelProvince('广东');
			//updatecityn('广州');
			//updateAll();
			document.getElementById("selCity").disabled='disabled';
		/*	alert("ip自动定位查询城市失不成功，请手动选择查询城市！");*/
		}	
	}catch(e)
	{
		document.getElementById("selCity").disabled='disabled';
/*		alert("ip自动定位查询城市失不成功，请手动选择查询城市！");*/
	}
}
function updateHistoryCars_m()
{
	var car1=getCookieCar(1);
	var historyhtml='';
	if(car1!=null)
	{
		_car1=car1;
		historyhtml+='<div class="quicktext"><b>快速查询</b>: 点击车牌即可快速查询违章结果</div><ul><li><a href="#" onClick="quickquery_m(_car1); return false;">'+_car1.pjc+_car1.cjc+_car1.cphm+'</a></li>';
		var car2=getCookieCar(2);
		if(car2!=null)
		{
			_car2=car2;
			historyhtml+='<li><a href="#" onClick="quickquery_m(_car2); return false;">'+_car2.pjc+_car2.cjc+_car2.cphm+'</a></li>';
			var car3=getCookieCar(3);
			if(car3!=null)
			{
				_car3=car3;
				historyhtml+='<li><a href="#" onClick="quickquery_m(_car3); return false;">'+_car3.pjc+_car3.cjc+_car3.cphm+'</a></li>';
				var car4=getCookieCar(4);
				if(car4!=null)
				{
					_car4=car4;
					historyhtml+='<li><a href="#" onClick="quickquery_m(_car4); return false;">'+_car4.pjc+_car4.cjc+_car4.cphm+'</a></li></ul><div class="clear"></div>';
					document.getElementById("historylistm").innerHTML=historyhtml;
					fillForm(_car4);
					return;
				}else//car4
				{
					historyhtml+='</ul><div class="clear"></div>';
					document.getElementById("historylistm").innerHTML=historyhtml;
					fillForm(_car3);
					return;
				}
			}else//car3
			{
				historyhtml+='</ul><div class="clear"></div>';
				document.getElementById("historylistm").innerHTML=historyhtml;
				fillForm(_car2);
				return;
			}
		}else//car2
		{
			historyhtml+='</ul><div class="clear"></div>';
			document.getElementById("historylistm").innerHTML=historyhtml;
			fillForm(_car1);
			return;
		}
	}
}
function quickquery_m(car)
{
	fillForm(car);
	fsubmit_m(1);
}
function checkcity(c_name)
{
	var info=getcityinfo2(c_name);
	if(info==null)
	{
		document.getElementById("provincesel").style.display="block";
		document.getElementById("citysel").style.display="block";
	}else
	{
		hideParam();
	}
}
function hideParam()
{
	if(_SelectCity.engineno==0)
	{
		document.getElementById("fadongjitr").style.display= "none";
	}else
	{
		document.getElementById("fadongjitr").style.display= "block";
	}
	if(_SelectCity.classno==0)
	{
		document.getElementById("chejiatr").style.display="none";
	}else
	{
		document.getElementById("chejiatr").style.display="block";
	}
}
function ScrollImgLeft(){ 
var speed=50; 
var scroll_begin = document.getElementById("scroll_begin"); 
var scroll_end = document.getElementById("scroll_end"); 
var scroll_div = document.getElementById("scroll_div"); 
scroll_end.innerHTML=scroll_begin.innerHTML; 
function Marquee(){ 
if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0) 
scroll_div.scrollLeft-=scroll_begin.offsetWidth; 
else 
scroll_div.scrollLeft++; 
} 
var MyMar=setInterval(Marquee,speed); 
scroll_div.onmouseover=function() {clearInterval(MyMar);} 
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed);} 
} 